package com.itheima_02;

/**
 * 方法重载：
 * 根据方法名和入参来判定是否重载: 方法名相同，入参个数或者类型不同
 * 不能根据返回值来判断方法是否重载
 */
public class MethodReload {
    public static void main(String[] args) {
        int a = 10, b = 20, c = 30;
        double d = 10.0, e = 20.0;
        System.out.println(sum(a, b));
        System.out.println(sum(d, e));
        System.out.println(sum(a, b, c));
    }

    public static int sum(int a, int b) {
        return a + b;
    }

    public static double sum(double a, double b) {
        return a + b;
    }

    public static int sum(int a, int b, int c) {
        return a + b + c;
    }
}
